Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing cache location and deleting old files #414

Merged
merged 8 commits into from
Nov 3, 2023
Merged

Conversation

alex-fang0
Copy link
Contributor

Why

User looking to modify the config file manually may get confused by all the different files in .bmx

@alex-fang0 alex-fang0 marked this pull request as ready for review October 30, 2023 19:10
@alex-fang0 alex-fang0 requested a review from a team as a code owner October 30, 2023 19:10
gord5500
gord5500 previously approved these changes Oct 31, 2023
Comment on lines 219 to 224
if( !Directory.Exists( BmxPaths.CACHE_DIR ) ) {
Directory.CreateDirectory( BmxPaths.CACHE_DIR );
File.Delete( Path.Join( BmxPaths.BMX_DIR, "awsCredsCache" ) );
File.Delete( Path.Join( BmxPaths.BMX_DIR, "sessions" ) );
File.Delete( Path.Join( BmxPaths.BMX_DIR, "update_check" ) );
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to handle exceptions gracefully here for the especially for the cleanup of the old files.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the Directory or File functions error out even if the files don't exist

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mhm, I was more concerned about the other exceptions. Especially for the cleanup part of this (i.e everything aside from CreateDirectory).
https://learn.microsoft.com/en-us/dotnet/api/system.io.file.delete?view=net-7.0#exceptions

Ideally we would like BMX to continue working if for w/e reason it can't actually delete those files.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha! makes sense

Copy link
Contributor

PR #415 created to format .cs files.

Auto format cache/file-location

Co-authored-by: DotNet Format Bot <[email protected]>
src/D2L.Bmx/Program.cs Outdated Show resolved Hide resolved
@alex-fang0 alex-fang0 merged commit 131c198 into main Nov 3, 2023
9 checks passed
@alex-fang0 alex-fang0 deleted the cache/file-location branch November 3, 2023 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants